package cn.edu.zafu.bigdata.YinMingyan.chapter04.q3;

// Book.java
public class Book {
    private String title;
    private String author;
    private double price;

    /**
     * Constructs a new Book with the given title, author, and price.
     * @param title the title of the book
     * @param author the author of the book
     * @param price the price of the book
     */
    public Book(String title, String author, double price) {
        this.title = title;
        this.author = author;
        this.price = price;
    }

    /**
     * Returns a string representation of the book.
     * @return a string representation of the book
     */
    @Override
    public String toString() {
        return String.format("Book[title=%s, author=%s, price=%.2f]", title, author, price);
    }

    // Getters and setters (if needed)
    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
}
